<?php
/**
 * Created by PhpStorm.
 * User: man0sions
 * Date: 16/8/25
 * Time: 下午9:16
 */
namespace src\base;


/**
 * Class SpiderContext
 * @package src\base
 * @author Luficer.p <81434146@qq.com>
 */
class SpiderContext extends Context{
    /**
     * SpiderContext constructor.
     * @param Request $request
     */
    public function __construct(Request $request)
    {
        $req = $request->get(1);
        if(!$req)
            throw new AppException("{$req} not exists");
        $path = 'spider/'.strtolower($req);
        $config = new Config($path);
        $this->set('config',$config[$path]);
        $app_config = ApplicationHelper::getInstance()->getConfig();
        $this->set('spider',$app_config['spider']);
    }
}